import { request } from "../../utils/request";
const isD = import.meta.env.MODE === 'development'
    ? ''
    : ''
// 查找产品
export function products(data: any, lang: 'en' | 'cn') {
    return request({
        url: `${isD}/dpl/v1/admin/products`,
        method: "get",
        params: data,
    });
}
// 获取产品的所有语言列表
export function productsDetail(data: any, lang: 'en' | 'cn') {
    return request({
        url: `${isD}/dpl/v1/admin/products/detail/${data}`,
        method: "get",
        // params: data,
    });
}
// 删除产品
// export function productsDel(data: any) {
//     return request({
//         url: `${isD}/dpl/v1/admin/products/delete`,
//         method: "put",
//         data,
//     });
// }
export function productsDel(data: any) {
    return request({
        url: `${isD}/dpl/v1/admin/products/${data}`,
        method: "delete",
        // data,
    });
}
// 增加产品
export function productsAdd(data: any) {
    return request({
        method: "post",
        url: `${isD}/dpl/v1/admin/products`,
        data,
    });
}
// 更新产品
export function productsEdit(data: any) {
    return request({
        method: "put",
        url: `${isD}/dpl/v1/admin/products`,
        data,
    });
}
// 更新上架状态 
export function productsStatus(data: any) {
    return request({
        method: "put",
        url: `${isD}/dpl/v1/admin/products/status`,
        data,
    });
}
// 产品排序
export function productOrder(data: any) {
    return request({
        method: "put",
        url: `${isD}/dpl/v2/admin/products/sort`,
        data,
    });
}

// 样式排序
export function productStyleOrder(data: any) {
    return request({
        method: "put",
        url: `${isD}/dpl/v2/admin/productStyle/sort`,
        data,
    });
}
// 查找产品样式
export function productStyle(data: any, lang: 'en' | 'cn') {
    return request({
        url: `${isD}/dpl/v1/admin/productStyle`,
        method: "get",
        params: data,
    });
}
// 删除产品样式
// export function productStyleDel(data: any) {
//     return request({
//         url: `${isD}/dpl/v1/admin/productStyle/delete`,
//         method: "put",
//         data,
//     });
// }
export function productStyleDel(data: any) {
    return request({
        url: `${isD}/dpl/v1/admin/productStyle/${data}`,
        method: "delete",
        // data,
    });
}
// 新增产品样式
export function productStyleAdd(data: any) {
    return request({
        method: "post",
        url: `${isD}/dpl/v1/admin/productStyle`,
        data,
    });
}
// 修改产品样式
export function productStyleEdit(data: any) {
    return request({
        method: "put",
        url: `${isD}/dpl/v1/admin/productStyle`,
        data,
    });
}
// 获取款式的所有语言列表
export function productStyleDetail(data: any, lang: 'en' | 'cn') {
    return request({
        url: `${isD}/dpl/v1/admin/productStyle/detail/${data}`,
        method: "get",
        // params: data,
    });
}
// 更新上架状态
export function productStyleStatus(data: any) {
    return request({
        method: "put",
        url: `${isD}/dpl/v1/admin/productStyle/status`,
        data,
    });
}
// 上传图片
export function productStyleUpload(data: any) {
    return request({
        method: "post",
        url: `${isD}/dpl/v1/admin/productStyle/upload`,
        data,
    });
}

// 上传图片
export function upload(data: any) {
    return request({
        method: "post",
        url: `${isD}/dpl/v1/admin/productStyle/upload`,
        data,
    });
}

// 获取用户内容列表
export function userContentList(data: any) {
    return request({
        method: "post",
        url: `/dpl/v2/admin/userContent/list`,
        data,
    });
}
// 修改用户内容的状态 上下架
export function userContent(data: any) {
    return request({
        url: `/dpl/v2/admin/userContent`,
        method: "put",
        data,
    });
}
// 删除用户内容
export function userContentDel(data: any) {
    return request({
        url: `/dpl/v2/admin/userContent/${data}`,
        method: "delete",
    });
}
// 获取评论列表
export function commentList(data: any) {
    return request({
        method: "post",
        url: `/dpl/v2/admin/comment/list`,
        data,
    });
}
// 更新评论状态 启用或禁用
export function comment(data: any) {
    return request({
        url: `/dpl/v2/admin/comment`,
        method: "put",
        data,
    });
}
// 删除评论
export function commentDel(data: any) {
    return request({
        url: `/dpl/v2/admin/comment/${data}`,
        method: "delete",
    });
}